import React, { Component } from "react";
import { Button } from "antd";
import { Pie } from "myEchart";

// import "../index.less";

class Pies extends Component {
    constructor(props) {
        super(props);
        this.myLine = null;
    }
    state = {
        current: "mail"
    };
    componentDidMount() {
        this.myLine = new Pie(
            document.getElementById("Amonitor"),
            [
                {
                    name: "饼图s",
                    data: [
                        { value: 335, name: "直接访问" },
                        { value: 310, name: "邮件营销" },
                        { value: 234, name: "联盟广告" },
                        { value: 135, name: "视频广告" },
                        { value: 1548, name: "搜索引擎" }
                    ]
                }
            ],
            []
        );
    }
    update = () => {
        this.myLine.setData({
            name: "t",
            data: [
                { value: 135, name: "视频广告" },
                { value: 1548, name: "搜索引擎" }
            ]
        });
    };
    render() {
        return (
            <div className="home base">
                <Button onClick={this.update}></Button>
                <div id="Amonitor" />
            </div>
        );
    }
}

export default Pies;
